# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=alsa-utils
pkgver=1.2.11
pkgrel=1
pkgdesc="Advanced Linux Sound Architecture (ALSA) utilities"
url="https://alsa-project.org/"
arch="all"
options="!check"  # No test suite, applets use ncurses / don't have --version
license="GPL-2.0-or-later"
makedepends="alsa-lib-dev fftw-dev ncurses-dev pciutils-dev xmlto"
depends="dialog alsa-ucm-conf"
subpackages="$pkgname-dbg alsaconf::noarch $pkgname-doc $pkgname-openrc"
source="https://alsa-project.org/files/pub/utils/alsa-utils-$pkgver.tar.bz2
	alsaconf.patch
	alsa.initd
	alsa.confd
	musl-locale.patch
	musl-types.patch
	"
prepare() {
	default_prepare
	update_config_sub
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--disable-nls \
		--with-alsactl-lock-dir=/run/lock
	make
}

package() {
	make DESTDIR="$pkgdir" install
	install -D -m755 ../alsa.initd "$pkgdir"/etc/init.d/alsa
	install -D -m644 ../alsa.confd "$pkgdir"/etc/conf.d/alsa
}

alsaconf() {
	depends="$pkgname=$pkgver-r$pkgrel bash"

	amove usr/sbin/alsaconf
}

sha512sums="
5ce76807b53357584bfb4ace5acfdac4db9168ffaf5cdd1e499738eec046c36112bf84a99970f66368063a9baf73bad93af2d439630572f3eba5c9321071172d  alsa-utils-1.2.11.tar.bz2
f04155e1e391c7f36d44422c8e769bf9370117f6bbea6c0664e9858f7a676cc958e4260e4b4d226e71d0716f6be4e6fdd60f1d07cb7e9922fff378ceec01c47d  alsaconf.patch
c66959a4a1a24a727c9c91a455caa5fa093c523d17a563b56ec2449a02ff30c83683db555006954b1fe571446cf4a117cc41de8c8b869a6e875d386595b3cc1f  alsa.initd
d7e212e9f624b09168117b46c66289204a23915adf0d1b0c9ae258049430397b8f2d86d3b5f7e3087151948a031c4eab863e8195a6c7b1276704e9cba9c2d2a7  alsa.confd
4b4b4d6406d57f592ecec9a79b5e401d1e1025e4f0b0d51ba233a5d2fcd1ce27ef336fda0242e7ff7d229d00428b7030d1d5789c9c306f824938366530eff6d9  musl-locale.patch
ee74137d5bf431090a2603c87c94f19063d9a62921b3c6bc1f19317e006a7ec278b66da9ccfb1b64fa5da46852f6a84ac2511b9ce74969799d0fca4cd9b2bc8d  musl-types.patch
"
